{if $operation=='list'}

<form method="post" name="editcustomfield" id="theform" action="admin.php?action=customfields" enctype="multipart/form-data"> 
	<input type="hidden" name="formhash" value="{FORMHASH}"> 
	<table class="tb tb2 "  style="min-width:910px; _width:910px;"> 
		<tr class="header">
			<th>删除</th>
			<th>配置名称</th>
			<th>自定义字段</th>
			<th>默认</th>
			<th>显示顺序</th>
			<th>编辑</th>
		</tr>
		{loop $listarr $v}
		<tr>
			<td>
				<input type="checkbox" name="delete[{$v[customfieldid]}]" value="1" />
			</td>
			<td>{$v[name]}</td>
			<td>$v[fields]</td>
			<td>$v[isdefault]</td>
			<td><input name="displayorder[{$v[customfieldid]}]" type="text" id="displayorder[{$v[customfieldid]}]" size="7" maxlength="" value="0" /></td>
			<td><a href="admin.php?action=customfields&operation=edit&customfieldid={$v[customfieldid]}">编辑</a></td>
		</tr>
		{/loop}
	</table>
	<input type="submit" name="listsubmit" value="提交保存" class="btn"> 
	<input type="reset" name="customfieldlistreset" value="重置" class="btn"> 
</form> 
{else}
	<script language="javascript">
	<!--
	function adddivcustomfield() {
		var oDiv=document.createElement("DIV");
		document.getElementById("div_customfield").appendChild(oDiv);
		oDiv.innerHTML = "{$jsstr}";
	}
	//-->
	</script>

<form method="post" name="addcustomfield" id="theform" action="admin.php?action=customfields" enctype="multipart/form-data" onSubmit="return validate(this)"> 
	<input type="hidden" name="formhash" value="{FORMHASH}"> 
	<table class="tb tb2 "  style="min-width:910px; _width:910px;"> 
		<tr> 
			<td width=120>配置名称</td> 
			<td><input name="name" type="text" id="name" size="30" value="{$thevalue[name]}" /></td>
		</tr> 
		<tr> 
			<td>自定义字段<p>字段类型为列表框、复选框时，您需要指定列表选项。列表选项中每一行文字代表一个选项</p></td> 
			<td>
				<div id="div_customfield">
					<table>
						<tr>
							<td width="130" align="center">字段名</td>
							<td width='135' align="center">字段类型</td>
							<td width='225' align="center">列表选项</td>
							<td width='135' align="center">显示位置</td>
							<td width='135' align="center">显示顺序</td>
						</tr>
					</table>
					{loop $thevalue[customfieldtext] $v}
					<table>
						<tr>
							<td width="130">
								<input type="text" name="customfieldname[]" size="20" value="{$v[name]}" />
							</td>
							<td width='135'>
								<select name="customfieldtype[]" style="width: 98%;">
									{loop $cftypearr $k $vr}
									<option value="$k" {if $v[type]==$k}selected=true{/if}>$vr</option>
									{/loop}
								</select>
							</td>
							<td width='225'>
								<textarea name="customfieldoption[]" rows="5"  style="width: 98%;">{$v[option]}</textarea>
							</td>
							<td width='135'>
								<select name="customfieldposition[]" style="width: 98%;">
										<option value="0" {if $v[position]!=1}selected{/if}>正文顶部</option>
										<option value="1" {if $v[position]==1}selected{/if}>正文底部</option>
								</select>
							</td>
							<td width='135'>
								<input type="text" name="customfieldorder[]" value="$v[order]">
							</td>
						</tr>
					</table>
					{/loop}
					<table>
						<tr>
							<td width="130">
								<input type="text" name="customfieldname[]" size="20" value="" />
							</td>
							<td width='135'>
								<select name="customfieldtype[]" style="width: 98%;">
									{loop $cftypearr $k $v}
									<option value="$k">$v</option>
									{/loop}
								</select>
							</td>
							<td width='225'>
								<textarea name="customfieldoption[]" rows="5" style="width: 98%;"></textarea>
							</td>
							<td width='135'>
								<select name="customfieldposition[]" style="width: 98%;">
										<option value="0" selected>正文顶部</option>
										<option value="1">正文底部</option>
								</select>
							</td>
							<td width='135'>
								<input type="text" name="customfieldorder[]" value="">
							</td>
						</tr>
					</table>
				</div>
				<input type="button" name="Submit" value="添加新字段" onClick="adddivcustomfield()" class="btn" />
			</td> 
		</tr> 
		<tr> 
			<td>默认</td> 
			<td>
				<input name="isdefault" type="radio" value="0"{if $thevalue[isdefault]!=1} checked{/if} />否
				<input name="isdefault" type="radio" value="1"{if $thevalue[isdefault]==1} checked{/if} />是
			</td> 
		</tr> 
		<tr> 
			<th>显示顺序</th> 
			<td><input name="displayorder" type="text" id="displayorder" size="10" value="{$thevalue[displayorder]}" /></td>
		</tr> 
	</table> 
	 
	<input name="customfieldid" type="hidden" value="{$thevalue[customfieldid]}" />
	<input name="valuesubmit" type="hidden" value="yes" />
	<input type="submit" name="thevaluesubmit" value="提交保存" class="btn"> 
	<input type="reset" name="editcustomfieldreset" value="重置" class="btn"> 
</form> 
{/if}